<?php
namespace app\admin\model;

use think\Model;

class FlowGroupUser extends Model 
{
    protected $table = 'workflow_group_user';
    
    protected $insert = ['isvalid' => 1];

    function getUserAuthGroup($uid = 0){
        $return_arr = array();
        if(isset($uid) && !empty($uid)){
            $where_cond = array(
                'isvalid' => 1,
                'uid' => $uid
            );
            $group_arr = db($this->table)->where($where_cond)->select();
            if(is_array($group_arr) && !empty($group_arr)){
                foreach ($group_arr as $key => $value){
                    $return_arr[] = $value['group_id'];
                }
            }
        }

        return $return_arr;
    }

}

